
package newcrunch.codeanalysis;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import net.sourceforge.pmd.util.datasource.DataSource;

public class PMDSourceFile implements DataSource 
{
    private String filename;
    private String code;
    
    public PMDSourceFile(String filename, String code)
    {
        this.filename = filename;
        this.code = code;
    }
    
    @Override
    public InputStream getInputStream() throws IOException 
    {
        return new ByteArrayInputStream(code.getBytes());
    }

    @Override
    public String getNiceFileName(boolean bln, String string) 
    {
        return filename;
    }

}
